package com.huitone.gddw.service.impl.worktable;

import java.util.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huitone.gddw.common.ComConstant;
import com.huitone.gddw.dao.entity.SvrNodeCodeRlt;
import com.huitone.gddw.dao.worktable.paramconfigmanage.ISvrNodeCodeRltDao;
import com.huitone.gddw.service.IParamtabRecService;
import com.huitone.gddw.service.ISvrNodeCodeRltService;
import com.huitone.gddw.utils.SysLoginUtil;

/**
* @Title SvrNodeCodeRltService
* @Package com.huitone.gddw.service.impl
* @Description TODO
* @author chengsiyue
* @date 2017年5月2日 上午10:52:09
* @version V1.0   
*/
@Service
public class SvrNodeCodeRltService implements ISvrNodeCodeRltService {

	@Autowired
	ISvrNodeCodeRltDao svrNodeCodeRltDao;
	
	@Autowired
	private IParamtabRecService paramtabRecService;

	@Override
	public int save(SvrNodeCodeRlt record) {
		record.setInsertStaffId(SysLoginUtil.getLoginUserId());
		record.setInsertTime(new Date());
		this.updateParamRec("保存业务端短信类型信息");
		return svrNodeCodeRltDao.save(record);
	}

	@Override
	public SvrNodeCodeRlt selectByPrimaryKey(String recId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(SvrNodeCodeRlt record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteBySvrNode(String svrNode) {
		this.updateParamRec("根据业务端编码删除业务端短信类型信息");
		return svrNodeCodeRltDao.deleteBySvrNode(svrNode);
	}


	@Override
	public int deleteByServiceCode(Map<String,Object> map) {
		this.updateParamRec("根据短信类型编码删除业务端短信类型信息");
		return svrNodeCodeRltDao.deleteByServiceCode(map);
	}
	
	/**
	 * 更新参数记录表
	 * @param desc 说明
	 */
	private void updateParamRec(String desc) {
		paramtabRecService.update(ComConstant.SVR_NODE_CODE_RLT, desc);
	}

}
